<template>
  <div>
  <!--  <div class="filter-container" style="margin-bottom: 10px">
      <el-input style="width: 50%" class="input-with-select" placeholder="请输入技师手机号码" v-model="searchName"
        @keyup.enter.native="query()">
      </el-input>
      <el-button class="filter-item" type="primary" slot="append" icon="el-icon-search" @click="query()">
        搜索
      </el-button>
    </div> -->
    <el-table border="true" stripe="true" :header-cell-style="{background:'#eef1f6',color:'#606266'}" :data="tableData"
      style="width: 99%" max-height="800px" @selection-change="handleSelectionChange">

      <el-table-column type="selection" width="55" align="center">
      </el-table-column>
      <el-table-column prop="template_id" label="模版号码" width="150" align="center">
      </el-table-column>

      <el-table-column prop="title" label="标题" width="100" align="center">
      </el-table-column>

      <el-table-column prop="primary_industry" label="一级行业" width="80" align="center">
      </el-table-column>
      <el-table-column prop="deputy_industry" label="二级行业" width="80" align="center">
      </el-table-column>
      <el-table-column prop="content" label="模版内容" width="250" align="center">
      </el-table-column>
      <el-table-column prop="example" label="案列" width="250" align="center">
      </el-table-column>
      <el-table-column align="center" label="操作" width="200">
        <template slot-scope="scope">
          <el-button type="primary" @click="edit(scope.$index, scope.row)" size="small" icon="el-icon-edit">确定
          </el-button>

        </template>
      </el-table-column>
    </el-table>
    <!-- <div class="pagectn">
      <el-pagination :page-size="10" layout="total, prev, pager, next, jumper" :total="pages"
        @current-change="pagechange">
      </el-pagination>
    </div> -->
  </div>
</template>
<script>
  import {
    getToken,
    gettemplate
  } from "@/api/user/user.js";
  export default {
    data() {
      let $domain = process.env.VUE_APP_BASE_API;
      return {
        tableData: [], //表格数据
        searchName: "", //搜索名
        pages: 0,
        domain: $domain,
        thispage: 1,
        token: '',
        admin:{}
      };
    },
    created() {
      this.admin = JSON.parse(sessionStorage.getItem('admin'));
      this.gettoken(this.admin.app_id)
    },
    methods: {
      query() {
        let _that = this;
        let data = {
          field: "tel",
          value: _that.searchName,
          op: "=",
        }
        getuser(data).then((res) => {
          _that.tableData = res.template_list
        })
      },
      handleSelectionChange(val) {
        this.multipleSelection = val
      },
      gettoken(app_id) {
        let _that = this;
        let data = {app_id:app_id}
        getToken(data).then((res) => {
          console.log('请求成功：', res);
          _that.requestuser(1)
        })
      },
      //请求页面第一个
      requestuser(pages) {
        let _that = this;
        let data = {app_id:this.admin.app_id}
        gettemplate(data).then((res) => {
          console.log('请求成功：', res);
          _that.tableData = res.template_list;
        })
      },
      // requestpage() {
      //   let _that = this
      //   let data = {
      //     field: "u_id",
      //     op: ">",
      //     value: 0,
      //   }
      //   usernum(data).then((res) => {
      //     _that.pages = res
      //   })
      // },
      // pagechange(page) {
      //   this.requestuser(page)
      //   this.thispage = page
      // },
    },
  }
</script>

<style scoped>
  .demo-table-expand {
    font-size: 0;
  }

  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }

  .demo-table-expand .el-form-item {
    margin-bottom: 0;
    width: 100%;
    white-space: pre-line;
  }

  .idc {
    margin-right: 15px;
    width: 40%;
    height: 300px;
  }

  .pagectn {
    width: 100%;
    background-color: #fff;
    padding: 5px;
    position: fixed;

    z-index: 100;
  }

  .idcardbox {
    display: flex;
  }
</style>
